<template>
	<view class="invite">
		<!-- 普通二维码 -->
		<image style="width: 100%;height: 100%;" v-if="storeInfo.ordinary_qr" :src="storeInfo.shop_pay_qrcode"
			mode="aspectFill"></image>
		<!-- 小程序码 -->
		<image style="width: 100%;height: 100%;" v-else :src="storeInfo.wx_shop_pay_qrcode" mode="aspectFill"></image>
	</view>
</template>

<script setup>
	import request from '@/utils/request';
	import checkLogin from '@/utils/login';
	import {
		ref,
		reactive,
		toRefs,
		inject
	} from 'vue';
	import {
		onLoad,
		onPullDownRefresh,
		onReachBottom,
	} from '@dcloudio/uni-app';

	const state = reactive({
		storeInfo: [],
	});

	onLoad((opt) => {
		//登录过期自动登录
		if (!checkLogin()) {
			pageRoute('/pages/users/login/login');
		} else {
			getStoreInfo();
		}
	});

	function getStoreInfo() {
		request.get('store/getStoreInfo').then(res => {
			state.storeInfo = res.data;
		})
	}

	function pageRoute(url) {
		uni.navigateTo({
			url
		});
	}

	const {
		storeInfo
	} = toRefs(state);
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100%;
	}

	.invite {
		width: 100%;
		height: 100%;
		background-size: 100% 100%;
		background-repeat: no-repeat;

	}
</style>